package com.leetcode;

import java.util.HashMap;

public class 找出字符串中的最长的递增序列 {

    HashMap<Integer, Integer> hashMap = new HashMap<Integer, Integer>();


    public int findLengher(int nums[], int i) {
        if (i == nums.length - 1) {
            return 0;
        }
        if (hashMap.containsKey(i)) {
            return hashMap.get(i);
        }
        int maxLen = 1;
        for (int j = i + 1; j < nums.length; j++) {
            if (nums[i] < nums[j]) {
                maxLen = Math.max(maxLen, findLengher(nums, j) + 1);
            }
        }
        hashMap.put(i, maxLen);
        return maxLen;
    }

    public static void main(String[] args) {
        找出字符串中的最长的递增序列 zc = new 找出字符串中的最长的递增序列();
        int[] nums = new int[]{1, 5, 2, 4, 3, 6, 7};
        System.out.println(zc.findLengher(nums, 0));
    }

}
